package
{
	import capricornus.res.Image;
	
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.events.MouseEvent;
	import flash.net.URLRequest;
	
	public class mycodetest extends Sprite
	{
		private var _img:Image;
		
		private var _url2:String = "d:\\test\\2222.png";
		private var _url:String = "d:\\test\\1111.png";
		
		public function mycodetest()
		{
			init();	
		}
		
		private function init():void
		{
			_img = new Image();
			addChild( _img );
			
			stage.addEventListener( MouseEvent.MOUSE_DOWN, onMouseDown );
		}
		
		private var _l:Loader;
		private function onMouseDown( e:MouseEvent ):void
		{
			doLoad();
			doLoad();
		}
		
		private function doLoad():void
		{
			if( _l )
			{
				_l.contentLoaderInfo.removeEventListener( IOErrorEvent.IO_ERROR, onError );
				try{_l.close();}catch(e:Error){};
				try{_l.unload();}catch(e:Error){};
			}
			_l = new Loader();
			_l.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, onError );
			_l.load( new URLRequest( _url ) );
		}
		
		private function onError( e:Event ):void
		{
			
		}
	}
}















